-
Notifications
You must be signed in to change notification settings - Fork 305
Expose CreatePollScreen and fix state restoration
#5958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose CreatePollScreen and fix state restoration
#5958
Conversation
SDK Size Comparison 📏
|
…l_screen_and_fix_state_restoration
CreatePollScreen and fix state restoration.CreatePollScreen and fix state restoration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR exposes the CreatePollScreen composable as a standalone component and fixes state restoration issues for poll creation across orientation changes.
- Extracts
CreatePollScreenfrom the attachment picker factory into a standalone composable - Implements a
CreatePollViewModelwith proper state management for configuration preservation - Adds visual improvements by highlighting selected tab icons for Poll and Location attachments
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| CreatePollScreen.kt | New standalone composable extracted from attachment picker factory |
| CreatePollViewModel.kt | New ViewModel handling poll creation state with proper lifecycle management |
| CreatePollViewModelTest.kt | Comprehensive test suite for the new ViewModel |
| CreatePollViewModelFactory.kt | Factory for creating ViewModel instances with configuration switches |
| AttachmentsPickerPollTabFactory.kt | Refactored to use the new CreatePollScreen composable |
| AttachmentsPicker.kt | Updated to use ViewModel state instead of local remember state |
| LocationPickerTabFactory.kt | Added highlighted icon for selected state |
| stream-chat-android-compose.api | API surface addition for the new public CreatePollScreen function |
| CHANGELOG.md | Documentation of the new feature and bug fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...n/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt
Show resolved
Hide resolved
...n/java/io/getstream/chat/android/compose/ui/messages/attachments/poll/CreatePollViewModel.kt
Show resolved
Hide resolved
...src/main/java/io/getstream/chat/android/compose/ui/messages/attachments/AttachmentsPicker.kt
Show resolved
Hide resolved
…reate_poll_screen_and_fix_state_restoration' into feature/AND-831_AND_832_expose_create_poll_screen_and_fix_state_restoration
…l_screen_and_fix_state_restoration # Conflicts: # CHANGELOG.md
andremion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…l_screen_and_fix_state_restoration # Conflicts: # CHANGELOG.md
|


🎯 Goal
CreatePollScreenso that it can used independently from theAttachmentsPickerPollTabFactory🛠 Implementation details
CreatePollScreenas a standalone composableCreatePollViewModeland move all state management fromCreatePollScreento theViewModelAttachmentsPickercomposable: Now reads the selected state from the viewModel instead of usingrememberPollandLocationattachments🎨 UI Changes
before.mp4
after.mp4
🧪 Testing
Polltab